<?php
class tvapi extends tvapi_default
{
    /**
     * @var settings
     */
    private $settings;

    public function registerSettings(settings $settings)
    {
        $this->settings = $settings;
    }

    public function loadMirrors($andPick = true, $forceLoad = false)
    {
        if (empty($this->settings->data['apimirror_xml']) || $forceLoad) {
            $mirrors = parent::loadMirrors();
            $this->settings->apimirror_xml = $this->getMirror('xml');
            $this->settings->apimirror_banner = $this->getMirror('banner');
            $this->settings->apimirror_zip = $this->getMirror('zip');
        } else {
            $mirrors = array(
                'xml' => array($this->settings->data['apimirror_xml']),
                'banner' => array($this->settings->data['apimirror_banner']),
                'zip'	=> array($this->settings->data['apimirror_zip'])
            );
        }

        $this->allMirrors = $mirrors;

        if ($andPick) {
            $this->pickMirror($mirrors);
        }

        return $mirrors;
    }
}